First-Class Functions in an Imperative World
نویسنده
چکیده
First-class functions are a hallmark of functional languages, but they are a useful concept in imperative languages, too. Even ANSI C offers a restricted form of first-class functions (in the form of pointers to functions), and several more recent imperative languages, such as Python 3, Go, Lua, and Swift, offer first-class, anonymous functions with lexical scoping. In most imperative languages, however, first-class functions are an advanced feature used by seasoned programmers. Lua, by contrast, uses first-class functions as a building block of the language. Lua programmers regularly benefit from diverse properties of its functions for routine constructions such as exception handling, module definitions, object-oriented programming, and iterators. Moreover, first-class functions play a central role in the API between Lua and C. In this paper, we present some aspects of Lua that were designed with first-class functions in mind, in particular its module system, exception handling, iterators, facilities for object-oriented programming, and the API between C and Lua. We also discuss how those different aspects of Lua use different properties of first-class functions to achieve two important goals in the design of Lua, namely small size and embeddability (its easiness of interfacing with other languages).
منابع مشابه
An Analysis of the Missions and Goals, Content, Tools, and Functions of Faculty development Centers in World-Class Universities: A Comparative Comparison
Introduction: The purpose of this study was to identify the missions and goals, content, tools, and functions of faculty development centers in world-class universities. Method: This study was conducted using qualitative approach and comparative comparison method and content analysis. Data were collected using the Times 2020 ranking site and sites of centers at world-class universities rated be...
متن کاملCoefficient Bounds for Analytic bi-Bazileviv{c} Functions Related to Shell-like Curves Connected with Fibonacci Numbers
In this paper, we define and investigate a new class of bi-Bazilevic functions related to shell-like curves connected with Fibonacci numbers. Furthermore, we find estimates of first two coefficients of functions belonging to this class. Also, we give the Fekete-Szegoinequality for this function class.
متن کاملDescriptive and Relative Completeness of Logics for Higher-Order Functions
This paper establishes a strong completeness property of compositional program logics for pure and imperative higher-order functions introduced in [2, 15–18]. This property, called descriptive completeness, says that for each program there is an assertion fully describing the former’s behaviour up to the standard observational semantics. This formula is inductively calculable from the program t...
متن کاملSome fixed point theorems for $C$-class functions in $b$-metric spaces
In this paper, via $C$-class functions, as a new class of functions, a fixed theorem in complete $b$-metric spaces is presented. Moreover, we study some results, which are direct consequences of the main results. In addition, as an application, the existence of a solution of an integral equation is given.
متن کاملSOLVING NONLINEAR TWO-DIMENSIONAL VOLTERRA INTEGRAL EQUATIONS OF THE FIRST-KIND USING BIVARIATE SHIFTED LEGENDRE FUNCTIONS
In this paper, a method for finding an approximate solution of a class of two-dimensional nonlinear Volterra integral equations of the first-kind is proposed. This problem is transformedto a nonlinear two-dimensional Volterra integral equation of the second-kind. The properties ofthe bivariate shifted Legendre functions are presented. The operational matrices of integrationtogether with the produ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- J. UCS
دوره 23 شماره
صفحات -
تاریخ انتشار 2017